

def find_anser(question):
    with open('replay.txt', 'r', encoding='gbk') as file:
        while True:
            line = file.readline()
            if line == '':
                break
            # 字符串分隔
            keyword = line.split('|')[0]
            replay = line.split('|')[1]
            if keyword in question:
                return replay
    return False

question = input('HI,xxx你好,小蜜在此等主人很久了,有什么烦恼快和小蜜说说吧~')
while True:
    if question == 'bye':
        break
    replay = find_anser(question)
    if not replay:
        question = input('小蜜不知道您说的是什么,您可以问一些关于订单、物流、支付等问题,退出请输入bye')
    else:
        print(replay)
        question = input('小主,您可以问一些关于订单、物流、支付等问题,退出请输入bye')
print('小主再见')
